; Kyle Kelly
; CS1221-B2
; Lab10
; FirstAssemblyProgram

.orig x3000

LD R0, A
LD R1, B
LD R2, STORE

ADD R3, R0, R1 ; Adding A and B
STR R3, R2, #0 ; Storing A+B in x5000

AND R3, R0, R1 ; ANDing A and B
STR R3, R2, #1 ; Storing A&B in x5001

NOT R4, R0	   ; Not A
NOT R5, R1	   ; Not B
AND R3, R4, R5 ; AND A' and B'
STR R3, R2, #2 ; Store your ORed A and B in x5002

ADD R6, R5, #1 ; Add 1 to B to make it -B
ADD R3, R0, R6 ; Add A and -B
STR R3, R2, #3 ; Store A-B in x5003

AND R6, R0, R5 ; AND A and ~B
AND R7, R1, R4 ; AND ~A and B
NOT R6, R6 		; NOT ln 22
NOT R7, R7		; NOT ln 23
AND R3, R6, R7	; AND the NOTed ANDS
NOT R3, R3		; NOT final answer
STR R3, R2, #4  ; store final answer in x5004

HALT

A .fill #27
B .fill #169
STORE .fill x5000
.END
